<template>
  <div class="app-container">
    <!-- 搜索 -->
    <el-card class="search-card">
      <el-form
        :model="queryParams"
        ref="queryForm"
        size="small"
        :inline="true"
        v-show="showSearch"
        class="formBox"
        label-width="90px"
      >
        <el-form-item label="学院" prop="collegeId">
          <el-select
            v-model="queryParams.collegeId"
            placeholder="请选择学院"
            style="width: 100%"
            @change="getCollegeModeListFun"
          >
            <el-option
              v-for="(item, index) in getSchoolCollegeListData"
              :label="item.collegeName"
              :value="item.id"
              :key="index"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="模式" prop="modelId">
          <el-select
            v-model="queryParams.modelId"
            placeholder="请选择模式"
            style="width: 100%"
            @change="getCollegeMajorListFun"
          >
            <el-option
              v-for="(item, index) in getCollegeModeListData"
              :label="item.modelName"
              :value="item.id"
              :key="index"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="专业名称" prop="majorId">
          <el-select
            v-model="queryParams.majorId"
            placeholder="请选择专业名称"
            style="width: 100%"
          >
            <el-option
              v-for="(item, index) in getCollegeMajorListData"
              :label="item.majorName"
              :value="item.id"
              :key="index"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="年级" prop="gradeId">
          <el-select v-model="queryParams.gradeId" placeholder="请选择年级">
            <el-option
              v-for="(item, index) in getSchoolGradeListData"
              :key="index"
              :label="item.grade"
              :value="item.id"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="缴费学年" prop="feeYearId">
          <el-select
            v-model="queryParams.feeYearId"
            placeholder="请选择收费学年"
            style="width: 100%"
          >
            <el-option
              v-for="(item, index) in getSchoolFeeYearListData"
              :label="item.feeYear"
              :value="item.id"
              :key="index"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="姓名" prop="studentName">
          <el-input
            placeholder="请输入姓名"
            class="width_100"
            v-model="queryParams.studentName"
          />
        </el-form-item>
        <el-form-item label="身份证号" prop="idNumber">
          <el-input
            placeholder="请输入身份证号"
            v-model="queryParams.idNumber"
          ></el-input>
        </el-form-item>
        <el-form-item label="支付状态" prop="billStatus">
          <el-select v-model="queryParams.billStatus" placeholder="请选择支付状态">
            <el-option label="未支付" value="10" />
            <el-option label="部分支付" value="20" />
            <el-option label="全额支付" value="30" />
            <el-option label="已作废" value="40" />
          </el-select>
        </el-form-item>
        <el-form-item label="退费状态" prop="refundStatus">
          <el-select v-model="queryParams.refundStatus" placeholder="请选择退费状态">
            <el-option label="未退款" value="10" />
            <el-option label="已退款" value="20" />
            <el-option label="待审核" value="30" />
            <el-option label="审核通过" value="40" />
          </el-select>
        </el-form-item>
        <el-form-item label="抵扣类型" prop="subjectId">
          <el-select v-model="queryParams.subjectId" placeholder="请选择抵扣类型">
            <el-option
              v-for="(item, index) in payPrepaymentQueryAllPrepaymentList"
              :label="item.projectName"
              :value="item.id"
              :key="index"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="最近支付时间" label-width="140px">
          <el-date-picker
            v-model="date"
            type="datetimerange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            format="yyyy-MM-dd HH:mm:ss"
            value-format="yyyy-MM-dd HH:mm:ss"
            :default-time="['00:00:00', '23:59:59']"
          />
        </el-form-item>
        <el-form-item>
          <el-button
            type="primary"
            icon="el-icon-search"
            size="mini"
            @click="handleQuery"
          >
            搜索
          </el-button>
          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
            >重置
          </el-button>
        </el-form-item>
      </el-form>
    </el-card>
    <!-- 按钮 -->
    <el-card class="box-card" style="margin-top: 10px">
      <el-row :gutter="10" class="mb8">
        <el-col :span="1.5">
          <el-button
            type="primary"
            plain
            icon="el-icon-plus"
            size="mini"
            @click="buttonMethod(1)"
            v-hasPermi="['charge:schoolFeeStandardsProject:student_sf:add']"
            >生成账单
          </el-button>
        </el-col>
        <el-col :span="1.5">
          <el-button
            type="warning"
            plain
            icon="el-icon-edit"
            size="mini"
            @click="handleExport"
            v-hasPermi="['charge:schoolFeeStandardsProject:student_sf:export']"
            >导出
          </el-button>
        </el-col>
        <right-toolbar
          :showSearch.sync="showSearch"
          @queryTable="getList"
        ></right-toolbar>
      </el-row>
    </el-card>
    <!-- 列表 -->
    <el-card class="table-card" style="margin-top: 10px">
      <el-table :data="dataList" stripe border>
        <el-table-column label="姓名" prop="studentName" fixed="left" />
        <el-table-column label="身份证号" prop="idNumber" width="140" fixed="left">
          <template slot-scope="scope">
            <el-tooltip
              class="item"
              effect="dark"
              :content="scope.row.idNumber"
              placement="bottom-start"
            >
              <div class="width_100 text-overflow">{{ scope.row.idNumber }}</div>
            </el-tooltip>
          </template>
        </el-table-column>
        <el-table-column label="学院" prop="collegeName" width="140" />
        <el-table-column label="模式" prop="modelName" width="140" />
        <el-table-column label="专业名称" prop="majorName" width="140" />
        <el-table-column label="年级" prop="gradeName" width="140" />
        <el-table-column label="收费学年" prop="feeYear" width="140" />
        <el-table-column label="应缴金额（元）" prop="amountPayable" width="120" />
        <el-table-column label="实缴金额（元）" prop="amountPaid" width="120" />
        <el-table-column label="待缴金额（元）" prop="amountPending" width="120" />
        <el-table-column label="退款金额（元）" prop="amountRefunded" width="120" />
        <el-table-column label="抵扣金额（元）" prop="amountDeducted" width="120" />
        <el-table-column label="账单状态">
          <template slot-scope="scope">
            <el-tag type="info" v-if="scope.row.billStatus == '10'">未支付</el-tag>
            <el-tag type="warning" v-if="scope.row.billStatus == '20'">部分支付</el-tag>
            <el-tag type="success" v-if="scope.row.billStatus == '30'">全额支付</el-tag>
            <el-tag type="danger" v-if="scope.row.billStatus == '40'">已作废</el-tag>
          </template>
        </el-table-column>
        <el-table-column label="退款状态">
          <template slot-scope="scope">
            <el-tag type="info" v-if="scope.row.refundStatus == '10'">未退款</el-tag>
            <el-tag type="warning" v-if="scope.row.refundStatus == '20'">已退款</el-tag>
            <el-tag type="success" v-if="scope.row.refundStatus == '30'">待审核</el-tag>
            <el-tag type="warning" v-if="scope.row.refundStatus == '40'">审核通过</el-tag>
          </template>
        </el-table-column>
        <el-table-column label="抵扣类型" prop="projectName" width="120" />
        <el-table-column label="操作人" prop="updateBy" width="120" />
        <el-table-column label="最近支付时间" prop="lastPaymentTime" width="170" />
        <el-table-column label="创建时间" prop="createTime" width="170" />
        <el-table-column label="备注" prop="createTime" width="150">
          <template slot-scope="scope">
            <el-tooltip
              class="item"
              effect="dark"
              :content="scope.row.remark"
              placement="bottom-start"
            >
              <div class="width_100 text-overflow">{{ scope.row.remark }}</div>
            </el-tooltip>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="200" fixed="right">
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="text"
              @click="buttonMethod(4, scope.row)"
              v-hasPermi="['charge:schoolFeeStandardsProject:student_sf:detail']"
              >详情
            </el-button>
            <el-button
              size="mini"
              type="text"
              @click="buttonMethod(5, scope.row)"
              v-if="scope.row.billStatus == '10'"
              v-hasPermi="['charge:schoolFeeStandardsProject:student_sf:void']"
              >作废
            </el-button>
            <el-button
              size="mini"
              type="text"
              @click="buttonMethod(6, scope.row)"
              v-if="scope.row.billStatus == '40'"
              v-hasPermi="['charge:schoolFeeStandardsProject:student_sf:void']"
              >删除
            </el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination
        v-show="total > 0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
      />
    </el-card>
    <!-- 添加、编辑 -->
    <el-dialog :title="title" :visible.sync="status" width="70%">
      <el-form label-width="120px" label-position="right" size="small" class="formBox">
        <el-row class="mb_10">
          <el-col :span="12">
            <el-form-item label="身份证号：" class="is-required">
              <el-select
                v-model="queryForm.info"
                filterable
                remote
                reserve-keyword
                placeholder="请输入完整的身份证号后进行搜索"
                :remote-method="queryFormInput"
                @change="queryFormInputChange"
                class="width_100"
              >
                <el-option
                  v-for="item in studentInfoList"
                  :key="item.value"
                  :label="item.name + '-' + item.idNumber"
                  :value="item"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="姓名：" class="is-required">
              <el-input v-model="queryForm.studentName" :placeholder="'请输入姓名'" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="收费学年：" class="is-required">
              <el-select
                v-model="queryForm.feeYearId"
                placeholder="请选择收费学年"
                style="width: 100%"
              >
                <el-option
                  v-for="(item, index) in getSchoolFeeYearListData"
                  :label="item.feeYear"
                  :value="item.id"
                  :key="index"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="学院：" class="is-required">
              <el-select
                v-model="queryForm.collegeId"
                placeholder="请选择学院"
                style="width: 100%"
                @change="getCollegeModeListFun"
              >
                <el-option
                  v-for="(item, index) in getSchoolCollegeListData"
                  :label="item.collegeName"
                  :value="item.id"
                  :key="index"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="模式：" class="is-required">
              <el-select
                v-model="queryForm.modelId"
                placeholder="请选择模式"
                style="width: 100%"
                @change="getCollegeMajorListFun"
              >
                <el-option
                  v-for="(item, index) in getCollegeModeListData"
                  :label="item.modelName"
                  :value="item.id"
                  :key="index"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="专业名称：" class="is-required">
              <el-select
                v-model="queryForm.majorId"
                placeholder="请选择专业名称"
                style="width: 100%"
              >
                <el-option
                  v-for="(item, index) in getCollegeMajorListData"
                  :label="item.majorName"
                  :value="item.id"
                  :key="index"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="学制：">
              <el-select
                v-model="queryForm.studyPeriod"
                placeholder="请选择学制"
                style="width: 100%"
              >
                <el-option label="6年" value="6" />
                <el-option label="5年" value="5" />
                <el-option label="4年" value="4" />
                <el-option label="3年" value="3" />
                <el-option label="2年" value="2" />
                <el-option label="1年" value="1" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="年级：" class="is-required">
              <el-select
                v-model="queryForm.gradeId"
                placeholder="请选择年级"
                style="width: 100%"
              >
                <el-option
                  v-for="(item, index) in getSchoolGradeListData"
                  :label="item.grade"
                  :value="item.id"
                  :key="index"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col
            :span="12"
            v-for="(item, index) in payFeeItemConfigGetListData"
            :key="index"
          >
            <el-form-item :label="item.feeItemConfigName + '：'" :class="item.mandatoryStatus == 1 ? 'is-required' : ''">
              <el-input
                v-model="item.itemPrice"
                :placeholder="'请输入' + item.feeItemConfigName"
                @blur="itemPriceBlur(item, index)"
                ><template slot="append">元</template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="状态：" class="is-required">
              <el-radio-group v-model="queryForm.closeStatus">
                <el-radio label="1">启用</el-radio>
                <el-radio label="2">停用</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="备注：">
              <el-input
                type="textarea"
                :autosize="{ minRows: 2, maxRows: 4 }"
                placeholder="请输入内容"
                v-model="queryForm.remark"
              />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="buttonMethod(2)">取 消</el-button>
        <el-button type="primary" @click="buttonMethod(3)">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog :title="title" :visible.sync="detail_status" width="70%">
      <el-form label-width="120px" label-position="right" size="small" class="formBox">
        <el-row class="mb_10">
          <el-col :span="12">
            <el-form-item label="身份证号：">
              <el-input v-model="detailInfo.idNumber" :readonly="true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="姓名：">
              <el-input v-model="detailInfo.studentName" :readonly="true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="收费学年：">
              <el-input v-model="detailInfo.feeYear" :readonly="true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="学院：">
              <el-input v-model="detailInfo.collegeName" :readonly="true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="模式：">
              <el-input v-model="detailInfo.modelName" :readonly="true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="专业名称：">
              <el-input v-model="detailInfo.majorName" :readonly="true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="学制：">
              <el-input
                :value="detailInfo.studyPeriod ? detailInfo.studyPeriod + '年' : ''"
                :readonly="true"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="年级：">
              <el-input v-model="detailInfo.gradeName" :readonly="true" />
            </el-form-item>
          </el-col>
          <el-col :span="12" v-for="(item, index) in detailInfo.details" :key="index">
            <el-form-item :label="item.feeItemConfigName + '：'">
              <el-input
                v-model="item.itemPrice"
                :placeholder="'请输入' + item.feeItemConfigName + '(只保留小数点后两位)'"
                :readonly="true"
                ><template slot="append">元</template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="状态：">
              <el-radio-group v-model="detailInfo.closeStatus">
                <el-radio label="1" disabled>是</el-radio>
                <el-radio label="2" disabled>否</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="备注：">
              <el-input
                type="textarea"
                :readonly="true"
                :autosize="{ minRows: 2, maxRows: 4 }"
                v-model="detailInfo.remark"
              />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </el-dialog>
  </div>
</template>
<script>
import {
  payStudentFeeList,
  payStudentFeePost,
  payStudentFeeCancel,
  queryByIdNumber,
  payStudentFeeDetail,
  payStudentFeeDelete,
} from "@/api/charge/student";
import { payPrepaymentQueryAllPrepayment } from "@/api/charge/index";
import { payFeeItemConfigGetList } from "@/api/charge/bo";

import {
  getSchoolFeeYearList,
  getSchoolCollegeList,
  getCollegeMajorList,
  getCollegeModeList,
  getSchoolGradeList,
} from "@/api/educational";
export default {
  name: "",
  data() {
    return {
      status: false,
      detail_status: false,
      title: "",
      dataList: [],
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        idNumber: null,
        collegeId: null,
        modelId: null,
        majorId: null,
        gradeId: null,
        feeYearId: null,
        billStatus: null,
        refundStatus: null,
        subjectId: null,
        lastPaymentStartTime: null,
        lastPaymentEndTime: null,
      },
      queryForm: {},
      total: 0,
      showSearch: true,
      date: [],
      headList: [],
      detailInfo: {},
      getSchoolFeeYearListData: [], //学校收费学年管理接口 查询学校收费信息列表（不分页）
      getSchoolCollegeListData: [], //学院信息管理接口 查询学院信息列表（不分页）
      getCollegeModeListData: [], //学院模式管理接口 查询模式信息列表（不分页）
      getCollegeMajorListData: [], //专业管理接口 查询专业信息列表（不分页）
      getSchoolGradeListData: [], //学校年级管理接口 查询学校年级信息列表（不分页）
      payFeeItemConfigGetListData: [], //收费配置--不分页，查询所有数据
      payPrepaymentQueryAllPrepaymentList: [], //预缴管理--查询所有预交费项目信息（不分页）
      studentInfoList: [],
    };
  },
  created() {
    this.getSchoolFeeYearListFun(); //学校收费学年管理接口 查询学校收费信息列表（不分页）
    this.getSchoolCollegeListFun(); //学院信息管理接口 查询学院信息列表（不分页）
    this.getSchoolGradeListFun(); //学校年级管理接口 查询学校年级信息列表（不分页）
    this.payFeeItemConfigGetListFun(); //收费配置--不分页，查询所有
    this.payPrepaymentQueryAllPrepaymentFun(); //预缴管理--查询所有预交费项目信息（不分页）
    this.getList(); //列表
  },
  methods: {
    // 学校收费学年管理接口 查询学校收费信息列表（不分页）
    getSchoolFeeYearListFun() {
      getSchoolFeeYearList().then((res) => {
        if (res.code == 200) {
          this.getSchoolFeeYearListData = res.data;
        }
      });
    },
    // 学院信息管理接口 查询学院信息列表（不分页）
    getSchoolCollegeListFun() {
      getSchoolCollegeList().then((res) => {
        if (res.code == 200) {
          this.getSchoolCollegeListData = res.data;
        }
      });
    },
    // 学院模式管理接口 查询模式信息列表（不分页）
    getCollegeModeListFun(options, status) {
      if (!status) {
        this.$set(this.queryParams, "modelId", "");
        this.$set(this.queryForm, "modelId", "");
        this.$set(this.queryParams, "majorId", "");
        this.$set(this.queryForm, "majorId", "");
      }
      getCollegeModeList({
        collegeId: options,
      }).then((res) => {
        if (res.code == 200) {
          this.getCollegeModeListData = res.data;
        }
      });
    },
    // 专业管理接口 查询专业信息列表（不分页）
    getCollegeMajorListFun(options, status) {
      if (!status) {
        this.$set(this.queryParams, "majorId", "");
        this.$set(this.queryForm, "majorId", "");
      }
      getCollegeMajorList({
        modelId: options,
      }).then((res) => {
        if (res.code == 200) {
          this.getCollegeMajorListData = res.data;
        }
      });
    },
    // 学校年级管理接口 查询学校年级信息列表（不分页）
    getSchoolGradeListFun() {
      getSchoolGradeList().then((res) => {
        if (res.code == 200) {
          this.getSchoolGradeListData = res.data;
        }
      });
    },
    // 预缴管理--查询所有预交费项目信息（不分页）
    payPrepaymentQueryAllPrepaymentFun() {
      payPrepaymentQueryAllPrepayment().then((res) => {
        if (res.code == 200) {
          this.payPrepaymentQueryAllPrepaymentList = res.data;
        }
      });
    },
    // 详情弹窗
    queryFormInput(options) {
      console.log(options);
      var that = this;
      // console.log(this.queryForm.idNumber);
      if (options.length == 18) {
        queryByIdNumber({
          idNumber: options,
        }).then((res) => {
          if (res.code == 200) {
            that.studentInfoList = res.data;
          }
        });
      }
    },
    // 查询条件输入框变化事件处理函数
    queryFormInputChange(options) {
      console.log(options);
      this.getCollegeModeListFun(options.collegeId, true);
      this.getCollegeMajorListFun(options.educationId, true);
      this.$set(this.queryForm, "studentName", options.name);
      this.$set(this.queryForm, "idNumber", options.idNumber);
      this.$set(this.queryForm, "feeYearId", options.feeYearId);
      this.$set(this.queryForm, "collegeId", options.collegeId);
      this.$set(this.queryForm, "modelId", options.educationId);
      this.$set(this.queryForm, "majorId", options.majorId);
      this.$set(this.queryForm, "studyPeriod", options.schoolSystem);
      this.$set(this.queryForm, "gradeId", options.gradeId);
    },
    // 获取列表数据
    getList() {
      var data = this.queryParams;
      console.log(data);
      if (this.date.length > 0) {
        data.lastPaymentStartTime = this.date[0];
        data.lastPaymentEndTime = this.date[1];
      }
      payStudentFeeList(data).then((res) => {
        if (res.code == 200) {
          this.dataList = res.rows;
          this.total = res.total;
        }
      });
    },
    // 详情弹窗
    payFeeItemConfigGetListFun() {
      payFeeItemConfigGetList().then((res) => {
        if (res.code == 200) {
          var arr = [];
          res.data.forEach((item) => {
            arr.push({
              feeItemConfigId: item.id,
              feeItemConfigName: item.itemName,
              mandatoryStatus:item.mandatoryStatus,
              itemPrice: 0,
            });
          });
          this.payFeeItemConfigGetListData = arr;
        }
      });
    },
    itemPriceBlur(item, index) {
      var itemPrice =
        item.itemPrice
          .replace(/[^/0-9.]/g, "")
          .replace(/(\.d+)\.+/g, "$1")
          .replace(/(\..*)\./g, "$1")
          .match(/^\d*(\.?\d{0,2})/g)[0] || "";
      item.itemPrice = itemPrice * 1;
    },  
    /**按钮点击事件处理方法*/
    buttonMethod(options, value) {
      //options 等于 1
      if (options == 1) {
        this.queryForm = {};
        this.title = "生成账单";
        this.status = true;
        this.studentInfoList = [];
        this.getCollegeModeListData = [];
        this.getCollegeMajorListData = [];
        this.payFeeItemConfigGetListFun();
      }
      //options 等于 2 关闭弹窗
      else if (options == 2) {
        this.queryForm = {};
        this.title = "";
        this.status = false;
        this.detail_status = false;
      }
      //options 等于 添加
      else if (options == 3) {
        var data = this.queryForm;
        if (!data.idNumber) {
          return this.$message.error("身份证号不能为空");
        }
        if (!data.studentName) {
          return this.$message.error("学生姓名不能为空");
        }
        if (!data.feeYearId) {
          return this.$message.error("收费学年不能为空");
        }
        if (!data.collegeId) {
          return this.$message.error("学院不能为空");
        }
        if (!data.modelId) {
          return this.$message.error("模式不能为空");
        }
        if (!data.majorId) {
          return this.$message.error("专业不能为空");
        }
        if (!data.studyPeriod) {
          return this.$message.error("学制不能为空");
        }
        if (!data.gradeId) {
          return this.$message.error("年级不能为空");
        }
        if (!data.closeStatus) {
          return this.$message.error("是否启用不能为空");
        }
        var status = true;
        this.payFeeItemConfigGetListData.forEach((item) => {
          if (item.itemPrice != 0) {
            item.itemPrice = this.numberMatchFun(item.itemPrice, 1);
          } else {
            item.itemPrice = item.itemPrice + "";
            if (!item.itemPrice) {
              status = false;
              return this.$message.error(item.feeItemConfigName + "不能为空");
            }
          }
        });
        if (status == true) {
          data.details = this.payFeeItemConfigGetListData;
          payStudentFeePost(data).then((res) => {
            if (res.code == 200) {
              this.$message.success(res.msg);
              this.resetQuery();
              this.status = false;
            } else {
              that.$message.error(res.msg);
            }
          });
        }
      }
      //
      else if (options == 4) {
        payStudentFeeDetail(value.id).then((res) => {
          if (res.code == 200) {
            this.title = "详情";
            this.detail_status = true;
            this.detailInfo = res.data;
          }
        });
      }
      // 5
      else if (options == 5) {
        this.$confirm("确定作废" + value.studentName + "的账单吗？", "作废账单", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        })
          .then(() => {
            payStudentFeeCancel(value.id).then((res) => {
              if (res.code == 200) {
                this.$message({
                  type: "success",
                  message: res.msg,
                });
                this.getList();
              } else {
                this.$message({
                  type: "error",
                  message: res.msg,
                });
              }
            });
          })
          .catch(() => {});
      } else if (options == 6) {
        this.$confirm("确定删除" + value.studentName + "的账单吗？", "作废账单", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        })
          .then(() => {
            payStudentFeeDelete(value.id).then((res) => {
              if (res.code == 200) {
                this.$message({
                  type: "success",
                  message: res.msg,
                });
                this.getList();
              } else {
                this.$message({
                  type: "error",
                  message: res.msg,
                });
              }
            });
          })
          .catch(() => {});
      }
    },
    /** 处理查询请求  将查询参数中的页码重置为1，并调用getList方法获取列表数据 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /**重置查询表单并重新执行查询操作*/
    resetQuery() {
      this.date = [];
      this.queryParams = {
        pageNum: 1,
        pageSize: 10,
        idNumber: null,
        collegeId: null,
        modelId: null,
        majorId: null,
        gradeId: null,
        feeYearId: null,
        billStatus: null,
        refundStatus: null,
        subjectId: null,
        lastPaymentStartTime: null,
        lastPaymentEndTime: null,
      };
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /**处理导出操作*/
    handleExport() {
      this.download(
        "/order/pay/payStudentFee/export",
        {
          ...this.queryParams,
        },
        `学生收费管理.xlsx`
      );
    },
    handleSelectionChange(options) {
      this.roleIds = options.map((item) => item.id);
      console.log(this.roleIds, "options");
    },
    numberMatchFun(options, multiple = 1) {
      // options 为必填参数，multiple 为倍数，默认为 1
      return Number((options / multiple + "").match(/^\d+(?:\.\d{0,2})?/));
    },
  },
};
</script>
<style scoped>
.width_100 {
  width: 100%;
}
</style>
